﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace GraphDrawing
{
    class Vertex
    {
        public Point possition;
        private int width;
        private int height;
        private Brush brushColor = Brushes.Black;
       
        public Vertex()
        {
            width = 10;
            height = 10;
        }

        public Vertex(int width, int height)
        {
            this.width = width;
            this.height = height;
        }

        public Vertex(int width, int height, Point possition)
        {
            this.width = width;
            this.height = height;
            this.possition = possition;
        }

        public void draw(Canvas canvas, bool isDisplayPosition, int index)
        {
            Ellipse circle = new Ellipse();
            circle.Width = width;
            circle.Height = height;
            circle.Fill = brushColor;
            Canvas.SetLeft(circle, possition.X - width/2);
            Canvas.SetTop(circle, possition.Y - height/2);

            if (isDisplayPosition)
            {
                TextBlock displayPosition = new TextBlock();
                //displayPosition.Text = "[ " + possition.X.ToString() + "," + possition.Y.ToString() + " ]";
                displayPosition.Text = index.ToString();
                displayPosition.Foreground = new SolidColorBrush(Colors.Black);
                displayPosition.FontWeight = FontWeights.Bold;
                Canvas.SetLeft(displayPosition, possition.X + width / 2);
                Canvas.SetTop(displayPosition, possition.Y + height / 2);

                canvas.Children.Add(displayPosition);
            }

            canvas.Children.Add(circle);
        }

        public int GetWidth()
        {
            return width;
        }

        public int GetHeight()
        {
            return height;
        }

        public void SetBrushColor(Brush brushesColor)
        {
            brushColor = brushesColor;
        }
    }
}
